<!--{include(file='head.html')}-->
<script type="text/javascript" src="template/jslib/upload/ajaxupload.js"></script>
<script type="text/javascript" src="template/jslib/date/WdatePicker.js"></script>
<script type="text/javascript" src="template/jslib/tbox/tbox.js"></script>
<link rel="stylesheet" href="template/jslib/tbox/tbox.css" type="text/css" />
<div id="wrap">
	<!--{include('left.html')}-->
	<div id="maincont">
		<b class="b1"></b><b class="b2"></b><b class="b3"></b><b class="b4"></b>
		<div id="main_c">
			<form name="seaform" id="seaform" action="<!--{url('admin','pic','index')}-->" method="post" onsubmit="$.oper.checkq('submit')">
			<div class="bt_bk">
				<span class="btn">
					<a href="javascript:void(0);" onclick="$.oper.refresh();return false;">刷新</a>
					<a href="javascript:void(0);" onclick="$.oper.remove();return false;">移除</a>
					<a href="javascript:void(0);" onclick="Pic.resizepic();return false;">缩略图</a>
				</span>
				<div id="buttonholder" style="margin-left:20px;"></div>
				<span class="search_bk">
					从 <input type="text" class="input_tx short" value="<!--{if $time1}--><!--{date('Y-m-d H:i',$time1)}--><!--{/if}-->" name="time1" onclick="WdatePicker()"/>
					到 <input type="text" class="input_tx short" value="<!--{if $time2}--><!--{date('Y-m-d H:i',$time2)}--><!--{/if}-->" name="time2" onclick="WdatePicker()" />
					<input type="text" class="input_tx <!--{if !$q}-->hintinput<!--{/if}-->" name="q" id="q" value="<!--{def($q,'图片名')}-->" onfocus="$.oper.checkq('focus')" onblur="$.oper.checkq('blur')"/>
					<input type="button" value="搜索" class="input_bt" onclick="$.oper.seasubmit()"/>
				</span>
				<span class="state_tip"></span>
			</div>
			<input type="hidden" value="<!--{def($pagearr['page'],1)}-->"		name="page" id="page"/>
			<input type="hidden" value="<!--{def($pagearr['pagesize'],10)}-->"	name="pagesize" id="pagesize" />
			</form>
			<!--{include_page("page.html","top")}-->
			<div class="sn3">
				<input type="checkbox" value="1" name="allselect" id="allselect" autocomplete="off" onclick="$.oper.selectall()"/> 全选
			</div>	
			<table class="tableStyle" border="0" cellspacing="0" cellpadding="0">
				<tbody id="listtbody" class="listpic">
					<tr align="center">
						<!--{foreach $pics pic}-->
						<td class="row_actions">
							<!--{if $pic.pic}-->
							<div class="imageItem" id="tr_<!--{$pic.picid}-->">
								<dl>
									<dd>
										<a href="<!--{$pic.pic}-->" target="_blank"> 
											<img src="<!--{$pic.pic}-->_50x50.jpg" id="img_<!--{$pic.picid}-->"/>
										</a>
									</dd>
								</dl>
								<ul>
									<p>
										<span onclick="$.oper.edit(this,'name','<!--{$pic.picid}-->')" title="点击修改图片名称" onmouseover="$.oper.bgcolor(this,'on')" onmouseout="$.oper.bgcolor(this,'off')" id="name_<!--{$pic.picid}-->"><!--{$pic.name}--></span>
									</p>
									<p>
										<input type="checkbox" value="<!--{$pic.picid}-->" name="singleselect" autocomplete="off" style="width:16px;height:16px;vertical-align:top"/>
										<a href="javascript:void(0)" onclick="$.oper.remove(<!--{$pic.picid}-->)" class="remove" title="移除"></a>
										<a href="javascript:void(0)" onclick="$.oper.copy('<!--{$weburl}--><!--{$pic.pic}-->')" class="copy" title="复制"></a>
										<a href="javascript:void(0)" onclick="Pic.resizepic('<!--{$pic.picid}-->')" class="resize" title="生成缩略图"></a>
										<a href="javascript:void(0)" onclick="Pic.replace('<!--{$pic.picid}-->')" class="replace" title="替换"></a>
									</p>
									<p style="visibility:hidden;" class="vh">
										<a href="<!--{$pic.pic}-->" target="_blank">原图</a>
										<!--{if $pic.spic}-->
											<a href="<!--{$pic.pic}-->_50x50.jpg" target="_blank">小图</a>
										<!--{/if}-->
										<!--{if $pic.bpic}-->
											<a href="<!--{$pic.pic}-->_160x160.jpg" target="_blank">中图</a>
										<!--{/if}-->
										<!--{if $pic.mpic}-->
											<a href="<!--{$pic.pic}-->_310x310.jpg" target="_blank">大图</a>
										<!--{/if}-->
									</p>
									<p style="visibility:hidden;" class="vh">尺寸：<!--{$pic.width}--> x <!--{$pic.height}-->，大小：<!--{round(floatval($pic.size/1024),2)}-->K</p>
									
								</ul>
							</div>
							<!--{/if}-->
							&nbsp;
						</td>
						<!--{if (($.foreach.default.index +1) % 4 ) == 0 && $.foreach.default.index!=11 }-->
							</tr>
							<tr align="center">
						<!--{/if}-->
						<!--{/foreach}-->
					</tr>
					
				</tbody>
			</table>
			<!--{include_page("page.html","foot")}-->
		</div>
		<b class="b4b"></b><b class="b3b"></b><b class="b2b"></b><b class="b1b"></b>
	</div>
</div>
<!--{include(file='foot.html')}-->
<script type="text/javascript">
function onComplete(id, fileName, serverData) {
	data = serverData;
	if(data.err) {
		jAlert(data.err);
	} else {
		$(".state_tip").text(fileName + " 上传成功！");
	}	
}
var Pic = {
	resizepic:function(id) {
		if(!id && !$.oper.checksel()) return false; 
		$.oper.dooper("resize",id,"refresh");
	},
	replace:function(id) {
		if(!id) return false;
		$.tbox.popup($.oper.url,"GET",{opertype:'replace',picid:id});
	}
}
$(function(){
	$.oper.init("<!--{url('admin','pic','picsave')}-->").setdefq('图片名');
	$(".row_actions").mouseover(function(){
		$(this).find(".vh").css({"visibility":"visible"});
	}).mouseout(function(){
		$(this).find(".vh").css({"visibility":"hidden"});
	});
	var uploader = new qq.FileUploader({action:"<!--{url('admin','uploadfile','pic')}-->",multiple:true});
});
</script>